package com.request.toyexchange;

/*
 * 接受申请之后，点击查看按钮看到的玩具信息
 */

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.bjtu.toyexchange.R;

public class CheckToyActivity extends Activity {
	private Button fanhui;
	Integer tid;
	String name, deg, state, detail, tphoto, tuser, user, date;
	TextView nameET, ownerET, degET, stateET, detailET;
	ImageView pic;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.toy_info);
		
		//得到玩具的名字
		Intent intent = this.getIntent();
//		name = intent.getStringExtra("title");
		
//		//得到玩具的详细描述，即玩具介绍
//		detail = intent.getStringExtra("content");
//		//状态
//		state = intent.getStringExtra("state");
//		//新旧
//		deg = intent.getStringExtra("level");
		//玩具所有者
		tuser = intent.getStringExtra("username");
//		//玩具的照片
//		tphoto = intent.getStringExtra("tphoto");
//		//玩具发布时间
//		date = intent.getStringExtra("date");
//		Log.v("date",date);
//		//玩具id
//		tid = intent.getIntExtra("tid", 0);
		
		//设置ImageView
		pic = (ImageView)findViewById(R.id.toy_ima);
		//设置几个Textview的值
		//名字
		nameET = (TextView)findViewById(R.id.toy_name);
		nameET.setText(name);
		//主人
		ownerET = (TextView)findViewById(R.id.toy_owner);
		ownerET.setText(tuser);
		//新旧程度
		degET = (TextView)findViewById(R.id.toy_deg);
		degET.setText(deg);
		//交换状态
		stateET = (TextView)findViewById(R.id.toy_sta);
		stateET.setText(state);
		//详细描述
		detailET = (TextView)findViewById(R.id.toy_det);
		detailET.setText(detail);
		
	    //隐藏申请交换玩具的按钮
		findViewById(R.id.exch_toy).setVisibility(View.GONE);
		
		//隐藏与主人联系的按钮
		findViewById(R.id.chat_owner).setVisibility(View.GONE);
		
		//返回的按钮
		fanhui = (Button)findViewById(R.id.btnbacktoy);
		fanhui.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				CheckToyActivity.this.finish();
			}
		});
	}
}
